import request from '@utils/request'
// 请求首页banner
const fetchBanner = () => request.get('/index')
// 请求推荐，热门等数据
const getHomegood = (type = 'sales', page = 1) => request.get('/index?' + type + '=1&page=' + page)
// 列表
const getList = () => request.get('/goods')
// 分类
const getListSort = (order = 'sales', cid = 0, page = 1) => request.get(`/goods?category_id=${cid}&page=${page}&${order}=1`)
// 获取详情
const getDetail = (id) => request.get(`/goods/${id}`)
// 登录
const login = (userinfo) => request.post('http://taizonga.top:3000/api/users/login', userinfo)
// 搜索
const search = (key) => request.get(`/goods?title=${key}`)
export {
  fetchBanner,
  getHomegood,
  getList,
  getListSort,
  getDetail,
  login,
  search
}
